#ifndef _TRANSIENT_BACKDROP_H_
#define _TRANSIENT_BACKDROP_H_

#include "ui/ui_sprite.h"
#include "script/scripthelper.h"
#include "script/write_lua.h"

namespace backdrop
{

class TransientDecal;

class TransientBackdrop
{
public:
	TransientBackdrop();
	virtual ~TransientBackdrop();

	void				SetBackgroundImg(const std::string& Sprite);
	TransientDecal*		AddDecal(const std::string& Sprite, const math::Vec2& Pos, const math::Vec2& Dir = math::Vec2(), int Layer = 0);
	void				AddDecal(TransientDecal* pDecal);
	TransientDecal*		GetDecal(const math::Vec2& Pos);
	void				DropDecal(TransientDecal* pDecal, bool bDelete = true);

	virtual void		Clear();
	virtual void		Tick(float dt, bool UpdatePos = true);
	virtual void		RenderBackground();
	virtual void		RenderDecals();
	void				Render();
	void				ResetDecals();

	virtual bool		Load(const std::string& File, bool bClear = true);
	virtual bool		Save(const std::string& File);
	bool				LoadTable(LuaPlus::LuaState* pScript);
	void				SaveTable(script::WriteLua& Output);

	// overrides - reserved for future use
	virtual math::Vec2	GetOffset() const { return math::Vec2(); }
	virtual bool		CanScroll() const { return false; }
	virtual bool		IsEmpty() const { return m_Decals.empty(); }

protected:
	ui::UISprite		m_BackgroundImg;
	std::string			m_Name;

	std::vector<TransientDecal*>	m_Decals;
};

}  // namespace backdrop

#endif // _TRANSIENT_BACKDROP_H_
